package com.test.webchat.Utils;

import org.springframework.web.socket.WebSocketSession;

public class WebSocketUtil {
    public static Integer getUserId(WebSocketSession session) {
        String query = session.getUri().getQuery();
        if (query != null && query.contains("userId=")) {
            String userId = query.split("userId=")[1];
            return Integer.parseInt(userId);
        }
        return null;
    }
}
